<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
 
 

<t:datagrid name="userList" title="诚信分数管理" actionUrl="userScoreController.do?datagrid" 
    fit="true" fitColumns="true" idField="id" queryMode="group" sortName="createDate" sortOrder="desc">
	<t:dgCol title="common.id" field="id" hidden="true"></t:dgCol>
	<%-- <t:dgCol title="common.username" sortable="false" field="userName" query="true"  width="120"></t:dgCol> --%>
	<t:dgCol title="学号" sortable="false" field="staffNo" query="true"  width="120"></t:dgCol>
 	<t:dgCol title="common.real.name" field="realName" query="false" width="120"></t:dgCol>
	<%-- <t:dgCol title="common.role" field="userKey"  width="120"></t:dgCol> --%>
	<%-- <t:dgCol title="生日"  field="birthday"  formatter="yyyy-MM-dd"   queryMode="single"  width="120"></t:dgCol> --%>
    <t:dgCol title="专业"  field="major.majorName"   queryMode="single"  width="120"></t:dgCol>
    <t:dgCol title="系别"  field="series.seriesName"    queryMode="single"  width="120"></t:dgCol>
	<t:dgCol title="班级"  field="stuClass.className"    queryMode="single"  width="120"></t:dgCol>
	<t:dgCol title="分数"  field="score"    queryMode="single"  width="60"></t:dgCol>
	<t:dgCol title="备注"  field="scoreRemark"    queryMode="single"  width="60"></t:dgCol> 	 
	<t:dgCol title="common.operation" field="opt"  width="200"></t:dgCol>
	<t:dgFunOpt funname="resetScore(id)" title="重置分数"></t:dgFunOpt> 
	<t:dgFunOpt funname="reductionScore(id)" title="扣除分数"></t:dgFunOpt>
	<t:dgFunOpt funname="setScore(id)" title="分数设置"></t:dgFunOpt>
	<t:dgFunOpt funname="showRemark(id)" title="备注填写"></t:dgFunOpt> 

 	<t:dgToolBar title="重置所有用户积分" langArg="common.user" icon="icon-add" url="studentController.do?rest" funname="rest" ></t:dgToolBar>
	 
 </t:datagrid>
<script>
	function reductionScore(id){
		 $.dialog({
				content: 'url:'+'userScoreController.do?showEditScore&id='+id,
				zIndex: getzIndex(),
				width:400,
				height: 200,
				lock:true,
				title:'扣除分数',
				opacity : 0.3,
				ok:function(){
					iframe = this.iframe.contentWindow;
					$('#btn_sub', iframe.document).click();
					reloadTable();
					return false;
				},
				cache:false, 
			    cancelVal: '关闭',
			    cancel: true /*为true等价于function(){}*/
			}); 
	}
	
	//设置分数
	function setScore(id){
		 $.dialog({
				content: 'url:'+'userScoreController.do?showSetScore&id='+id,
				zIndex: getzIndex(),
				width:400,
				height: 200,
				lock:true,
				title:'设置分数',
				opacity : 0.3,
				ok:function(){
					iframe = this.iframe.contentWindow;
					$('#btn_sub', iframe.document).click();
					reloadTable();
					return false;
				},
				cache:false, 
			    cancelVal: '关闭',
			    cancel: true /*为true等价于function(){}*/
			}); 
	}
	
	function showRemark(id){
		 $.dialog({
				content: 'url:'+'userScoreController.do?showUserScoreRemark&id='+id,
				zIndex: getzIndex(),
				width:400,
				height: 200,
				lock:true,
				title:'填写备注',
				opacity : 0.3,
				ok:function(){
					iframe = this.iframe.contentWindow;
					$('#btn_sub', iframe.document).click();
					reloadTable();
					return false;
				},
				cache:false, 
			    cancelVal: '关闭',
			    cancel: true /*为true等价于function(){}*/
			}); 
	}
	
	
	
	//重置所有分数
	function rest(){
		$.dialog.confirm('确定要重置分数吗?', function(r) {
			 if (r) {
				 $.ajax({
						url:"userScoreController.do?reset",
						success:function(d){
							d = $.parseJSON(d);
							reloadTable();
							tip(d.msg);
						}
					});
			}
		});
		
	}
	
	//重置某个用户积分
	function resetScore(id){
		
		$.dialog.confirm('确定要重置分数吗?', function(r) {
			 if (r) {
					$.ajax({
						url:"userScoreController.do?reset&userId="+id,
						success:function(d){
							d = $.parseJSON(d);
							reloadTable();
							tip(d.msg);
						}
					});		 
			}
		});
		
	
	}
</script>
 
